package com.dexilaonian.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dexilaonian.R;
import com.dexilaonian.ui.BaseActivity;
import com.dexilaonian.utils.Logutil;
import com.dexilaonian.view.DatePickerPopWin;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class HealthRecordActivity extends BaseActivity {

    @Bind(R.id.back)
    ImageView back;
    @Bind(R.id.base_title_service3)
    TextView baseTitleService3;
    @Bind(R.id.et_health_name)
    EditText etHealthName;
    @Bind(R.id.et_health_sex)
    EditText etHealthSex;
    @Bind(R.id.et_health_cardid)
    EditText etHealthCardid;
    @Bind(R.id.et_health_phone)
    EditText etHealthPhone;
    @Bind(R.id.et_health_height)
    EditText etHealthHeight;
    @Bind(R.id.et_health_weight)
    EditText etHealthWeight;
    @Bind(R.id.tv_year_mon)
    TextView tvYearMon;
    @Bind(R.id.rl_year_mon)
    RelativeLayout rlYearMon;
    @Bind(R.id.btn_health)
    Button btnHealth;

    @Override
    public int getLayoutID() {
        return R.layout.activity_health_record;
    }

    @Override
    public void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.back, R.id.rl_year_mon, R.id.btn_health})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.rl_year_mon:
                initBirth();
                break;
            case R.id.btn_health:
                break;
        }
    }
    private void initBirth() {

        DatePickerPopWin pickerPopWin = new DatePickerPopWin.Builder(HealthRecordActivity.this, new DatePickerPopWin.OnDatePickedListener() {
            @Override
            public void onDatePickCompleted(int year, int month, int day, String dateDesc) {
                Logutil.e(dateDesc);
                tvYearMon.setText(dateDesc);
            }
        }).textConfirm("确定") //text of confirm button
                .textCancel("取消") //text of cancel button
                .btnTextSize(16) // button text size
                .viewTextSize(25) // pick view text size
                .colorCancel(Color.parseColor("#999999")) //color of cancel button
                .colorConfirm(Color.parseColor("#009900"))//color of confirm button
                .minYear(1900) //min year in loop
                .maxYear(2550) // max year in loop
                .dateChose("2013-11-11") // date chose when init popwindow
                .build();
        pickerPopWin.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);
        pickerPopWin.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        pickerPopWin.showPopWin(HealthRecordActivity.this);
    }
}
